﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ordre_Treball.aspx.cs"
    Inherits="Vista.Privat.Ordre_Treball" MasterPageFile="~/Gestio/GestioMasterPage.master" %>

<%@ MasterType VirtualPath="~/Gestio/GestioMasterPage.master" %>

<%@ Register Src="~/Controls/ModalPanel.ascx" TagPrefix="ctrl" TagName="Modal" %>
<%@ Register Src="~/Controls/Carregant.ascx" TagPrefix="ctrl" TagName="Carregant" %>
<%@ Register Src="~/Controls/FilmacioMaquines.ascx" TagPrefix="ctrl" TagName="FilmacioMaquines" %>


<asp:Content ID="bodyOrdre" ContentPlaceHolderID="privateCPHBody" runat="server">
    <script type="text/javascript">
        function PrintingOrdre() {
            var panel = document.getElementById("<%=upCrearOrdre.ClientID %>");
            var printWindow = window.open('', '', 'height=400,width=800');
            printWindow.document.write('<html><head><title>Crear Ordre</title>');
            printWindow.document.write('</head><body >');
            printWindow.document.write(panel.innerHTML);
            printWindow.document.write('</body></html>');
            printWindow.document.close();

            setTimeout(function () {
                printWindow.print();
            }, 500);

            // Tanca la finestra al cap de 8 segons
            setTimeout(function () {
                printWindow.close();
            }, 5000);

            return true;
        }

        function RecalculaImports() {

            var import1 = $get('<%=txtImport1.ClientID %>');
            var import2 = $get('<%=txtImport2.ClientID %>');
            var import3 = $get('<%=txtImport3.ClientID %>');
            var import4 = $get('<%=txtImport4.ClientID %>');
            var import5 = $get('<%=txtImport5.ClientID %>');
            var import6 = $get('<%=txtImport6.ClientID %>');
            var import7 = $get('<%=txtImport7.ClientID %>');
            var import8 = $get('<%=txtImport8.ClientID %>');
            var import9 = $get('<%=txtImport9.ClientID %>');
            var import10 = $get('<%=txtImport10.ClientID %>');
            var import11 = $get('<%=txtImport11.ClientID %>');
            var importTotal = $get('<%=txtImportTotal.ClientID %>');

            //var importTotal = 0;

            if (import1.value == "")
                import1.value = 0;

            if (import2.value == "")
                import2.value = 0;

            if (import3.value == "")
                import3.value = 0;

            if (import4.value == "")
                import4.value = 0;

            if (import5.value == "")
                import5.value = 0;

            if (import6.value == "")
                import6.value = 0;

            if (import7.value == "")
                import7.value = 0;

            if (import8.value == "")
                import8.value = 0;

            if (import9.value == "")
                import9.value = 0;

            if (import10.value == "")
                import10.value = 0;

            if (import11.value == "")
                import11.value = 0;

            if (importTotal.value == "")
                importTotal.value = 0;

            importTotal.value = parseFloat(import1.value) + parseFloat(import2.value) + parseFloat(import3.value) + parseFloat(import4.value) + parseFloat(import5.value) +
            parseFloat(import6.value) + parseFloat(import7.value) + parseFloat(import8.value) + parseFloat(import9.value) + parseFloat(import10.value) +
            parseFloat(import11.value);
        }
 </script>
    <div id="divBodyOrdre">
        <%--Crear nova ordre--%>
        <asp:UpdatePanel ID="upCrearOrdre" runat="server" Visible="false" UpdateMode="Conditional">
            <ContentTemplate>
                <div>
                    <br />
                    <table width="100%">
                        <tr>
                            <td style="width: 25%">
                                <asp:Label ID="lblTitulCrearOrdre" CssClass="classTitul" Text="Crear Ordre: " runat="server" />
                            </td>
                            <td style="width: 50%">
                                <table>
                                    <tr>
                                        <td>
                                            <asp:Label ID="Label4" CssClass="classTitul" Text="Data Entrega: " runat="server" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtDataEntrega" runat="server" ToolTip="aa/mm/aaaa" />
                                            <%--<asp:Calendar ID="calenDataEntrega" runat="server" />--%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="Label5" CssClass="classTitul" Text="Hora Entrega: " runat="server" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtHoraEntrega" runat="server" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table width="100%">
                        <tr>
                            <td>
                                <%--Primera Fila--%>
                                <table width="95%">
                                    <tr>
                                        <td align="center" style="width: 50%">
                                            <asp:Label Text="Client" runat="server" />
                                        </td>
                                        <td align="center">
                                            <asp:Label Text="Impresor" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:DropDownList ID="ddlClient" runat="server" Width="100%" AutoPostBack="true"
                                             DataSourceID="odsClient" DataTextField="NomClient" DataValueField="IdClient" 
                                             OnTextChanged="ddlClient_TextChanged"/>
                                            
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlImpresor" runat="server" Width="100%" AutoPostBack="true"
                                                DataSourceID="odsClient" DataTextField="NomClient" DataValueField="IdClient"
                                                OnTextChanged="ddlImpresor_TextChanged" />
                                        </td>
                                        <%--Carrega l'objecte client des de negoci--%>
                                        <asp:ObjectDataSource ID="odsClient" runat="server" DataObjectTypeName="DeltaFlex.Negoci.Client"
                                            SelectMethod="LlistarClientByIDClient" TypeName="DeltaFlex.Negoci.Client">
                                            <SelectParameters>
                                                <asp:QueryStringParameter Name="idClient" QueryStringField="empid" DefaultValue="0" />
                                            </SelectParameters>
                                        </asp:ObjectDataSource>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%--Segona Fila--%>
                                <table width="95%">
                                    <tr>
                                        <td align="center" style="width: 40%">
                                            <asp:Label Text="Referencia Client" runat="server" />
                                        </td>
                                        <td align="center">
                                            <asp:Label Text="ID. Treball" runat="server" />
                                        </td>
                                        <td align="center" style="width: 20%">
                                            <asp:Label Text="Pedido Client" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="txtRefClient" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtIDTreball" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtPedidoClient" runat="server" Width="95%" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%--Tercera Fila--%>
                                <table width="95%">
                                    <tr>
                                        <td align="center" style="width: 25%">
                                            <asp:Label Text="Tipus Treball" runat="server" />
                                        </td>
                                        <td align="center" style="width: 25%">
                                            <asp:Label Text="Tipus Caixa" runat="server" />
                                        </td>
                                        <td align="center" style="width: 10%">
                                            <asp:Label Text="Fitxa" runat="server" />
                                        </td>
                                        <td align="center" style="width: 25%">
                                            <asp:Label Text="Colors" runat="server" />
                                        </td>
                                        <td align="center" style="width: 15%">
                                            <asp:Label Text="Tipus Clitxe" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:DropDownList ID="ddlTipoTreball" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlTipoCaixa" runat="server" Width="100%" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtFitxa" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtColors1" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlTipoClitxe1" runat="server" Width="100%" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%--Quarta Fila--%>
                                <table width="95%">
                                    <tr>
                                        <td align="center" style="width: 16%">
                                            <asp:Label Text="Tipus Mesures" runat="server" />
                                        </td>
                                        <td align="center" style="width: 16%">
                                            <asp:Label Text="Mesures" runat="server" />
                                        </td>
                                        <td align="center" style="width: 16%">
                                            <asp:Label Text="Nº Troquel" runat="server" />
                                        </td>
                                        <td align="center" style="width: 12%">
                                            <asp:Label Text="Poses" runat="server" />
                                        </td>
                                        <td style="width: 25%">
                                            <asp:TextBox ID="txtColors2" runat="server" Width="95%" />
                                        </td>
                                        <td style="width: 15%">
                                            <asp:DropDownList ID="ddlTipoClitxe2" runat="server" Width="100%" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:DropDownList ID="ddlTipoMesures" runat="server" Width="95%">
                                                <asp:ListItem Text="Interior" Value="interior" />
                                                <asp:ListItem Text="Exterior" Value="exterior" />
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtMesures" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtNumTroquel" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtPoses" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtColors3" runat="server" Width="95%" />
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlTipoClitxe3" runat="server" Width="100%    " />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%--Cinquena Fila--%>
                                <table width="95%">
                                    <tr>
                                        <td align="center" style="width: 60%">
                                            <asp:Label ID="Label2" Text="Material Adjunt" runat="server" />
                                        </td>
                                        <td style="width: 40%">
                                            <table width="100%">
                                                <tr>
                                                    <td style="width: 42%">
                                                        <asp:TextBox ID="txtColors4" runat="server" Width="95%" />
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlTipoClitxe4" runat="server" Width="100%" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="width: 60%">
                                            <asp:TextBox TextMode="MultiLine" ID="txtMaterialAdjunt" runat="server" Width="99%" />
                                        </td>
                                        <td>
                                            <table width="100%">
                                                <tr>
                                                    <td style="width: 42%">
                                                        <asp:TextBox ID="txtColors5" runat="server" Width="95%" />
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlTipoClitxe5" runat="server" Width="100%" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 42%">
                                                        <asp:TextBox ID="txtColors6" runat="server" Width="95%" />
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlTipoClitxe6" runat="server" Width="100%" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%--Sisena Fila--%>
                                <table width="95%">
                                    <tr>
                                        <td align="center" style="width: 60%">
                                            <asp:Label Text="Material a Tornar" runat="server" />
                                        </td>
                                        <td style="width: 40%">
                                            <table width="100%">
                                                <tr>
                                                    <td style="width: 42%">
                                                        <asp:TextBox ID="txtColors7" runat="server" Width="95%" />
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlTipoClitxe7" runat="server" Width="100%" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 60%">
                                            <asp:TextBox ID="txtMaterialTornar" runat="server" TextMode="MultiLine" Width="99%" />
                                        </td>
                                        <td style="width: 40%">
                                            <table width="100%">
                                                <tr>
                                                    <td style="width: 42%">
                                                        <asp:TextBox ID="txtColors8" runat="server" Width="95%" />
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlTipoClitxe8" runat="server" Width="100%" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 42%">
                                                        <asp:TextBox ID="txtColors9" runat="server" Width="95%" />
                                                    </td>
                                                    <td style="width: 25%">
                                                        <asp:DropDownList ID="ddlTipoClitxe9" runat="server" Width="100%" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <%--Setena Fila--%>
                                <table width="95%">
                                    <tr>
                                        <td align="center" style="width: 60%">
                                            <asp:Label Text="Màquina" runat="server" />
                                        </td>
                                        <td align="center" style="width: 20%">
                                            <asp:Label Text="Deflacció" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="width: 60%">
                                            <asp:DropDownList ID="ddlMaquina" runat="server" Width="99%" AutoPostBack="true"
                                                OnTextChanged="ddlMaquina_TextChanged" />
                                        </td>
                                        <td style="width: 25%">
                                            <asp:TextBox ID="txtDeflacció" runat="server" Width="95%" />
                                        </td>
                                        <td style="width: 20%">
                                            <asp:Button ID="btnImprimirMaquina" runat="server" Text="Imprimir Màquina" Width="95%" 
                                            OnClick="btnImprimirMaquina_Click" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <asp:Label Text="Feina a Fer" runat="server" Width="90%" CssClass="classTextOrdre" />
                    <br />
                    <asp:TextBox ID="txtFeinaFer" runat="server" TextMode="MultiLine" Height="150" Width="95%" />
                    <div id="divAvisConcepte_OT" runat="server" style="color: Red; margin-top: 10px;
                        margin-bottom: 10px;">
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant1" Type="Integer" Text="Quantitat concepte 1 incorrecta &nbsp;&nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple1" Type="Double" Text="&nbsp; Amplada concepte 1 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt1" Type="Double" Text="&nbsp; Altura concepte 1 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant2" Type="Integer" Text="<br /> Quantitat concepte 2 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple2" Type="Double" Text="&nbsp; Amplada concepte 2 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt2" Type="Double" Text="&nbsp; Altura concepte 2 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant3" Type="Integer" Text="<br /> Quantitat concepte 3 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple3" Type="Double" Text="&nbsp; Amplada concepte 3 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt3" Type="Double" Text="&nbsp; Altura concepte 3 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant4" Type="Integer" Text="<br /> Quantitat concepte 4 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple4" Type="Double" Text="&nbsp; Amplada concepte 4 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt4" Type="Double" Text="&nbsp; Altura concepte 4 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant5" Type="Integer" Text="<br /> Quantitat concepte 5 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple5" Type="Double" Text="&nbsp; Amplada concepte 5 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt5" Type="Double" Text="&nbsp; Altura concepte 6 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant6" Type="Integer" Text="<br /> Quantitat concepte 6 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple6" Type="Double" Text="&nbsp; Amplada concepte 6 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt6" Type="Double" Text="&nbsp; Altura 6e concepte incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant7" Type="Integer" Text="<br /> Quantitat concepte 7 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple7" Type="Double" Text="&nbsp; Amplada concepte 7 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt7" Type="Double" Text="&nbsp; Altura concepte 7 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant8" Type="Integer" Text="<br /> Quantitat concepte 8 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple8" Type="Double" Text="&nbsp; Ampladaconcepte 8 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt8" Type="Double" Text="&nbsp; Altura concepte 8 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant9" Type="Integer" Text="<br /> Quantitat concepte 9 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple9" Type="Double" Text="&nbsp; Amplada concepte 9 incorrecta &nbsp; "
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt9" Type="Double" Text="&nbsp; Altura concepte 9 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant10" Type="Integer" Text="<br /> Quantitat concepte 10 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple10" Type="Double" Text="&nbsp; Amplada concepte 10 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt10" Type="Double" Text="&nbsp; Altura concepte 10 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtCant11" Type="Integer" Text="<br /> Quantitat concepte 11 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAmple11" Type="Double" Text="&nbsp; Amplada concepte 11 incorrecta &nbsp;"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                        <asp:RangeValidator runat="server" ControlToValidate="txtAlt11" Type="Double" Text="&nbsp; Altura concepte 11 incorrecta"
                            Display="Dynamic" SetFocusOnError="true" MinimumValue="0" MaximumValue="3156" />
                    </div>
                    <%--Carrega l'objecte Articles des de negoci--%>
                    <asp:ObjectDataSource ID="odsArticles" runat="server" DataObjectTypeName="DeltaFlex.Negoci.Articles"
                        SelectMethod="LlistaTotsArticles" TypeName="DeltaFlex.Negoci.Articles" />
                                            
                    <table width="95%">
                        <tr>
                            <td align="center" style="width: 10%">
                                <asp:Label runat="server" Text="Cant." />
                            </td>
                            <td align="center" style="width: 40%">
                                <asp:Label runat="server" Text="Concepte" />
                            </td>
                            <td align="center" style="width: 10%">
                                <asp:Label runat="server" Text="Ample" />
                            </td>
                            <td align="center" style="width: 10%">
                                <asp:Label runat="server" Text="Alt" />
                            </td>
                            <td align="center" style="width: 10%">
                                <asp:Label runat="server" Text="Import" />
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    1.</label>
                                <asp:TextBox ID="txtCant1" runat="server" Width="70%" AutoPostBack="false" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT1" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple1" runat="server" Width="99%" AutoPostBack="false" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt1" runat="server" Width="97%" AutoPostBack="false" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport1" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    2.</label>
                                <asp:TextBox ID="txtCant2" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT2" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple2" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt2" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport2" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    3.</label>
                                <asp:TextBox ID="txtCant3" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT3" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple3" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt3" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport3" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    4.</label>
                                <asp:TextBox ID="txtCant4" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT4" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple4" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt4" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport4" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    5.</label>
                                <asp:TextBox ID="txtCant5" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT5" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple5" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt5" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport5" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    6.</label>
                                <asp:TextBox ID="txtCant6" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT6" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple6" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt6" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport6" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    7.</label>
                                <asp:TextBox ID="txtCant7" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT7" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple7" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt7" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport7" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    8.</label>
                                <asp:TextBox ID="txtCant8" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT8" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple8" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt8" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport8" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    9.</label>
                                <asp:TextBox ID="txtCant9" runat="server" Width="70%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT9" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple9" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt9" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport9" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    10.</label>
                                <asp:TextBox ID="txtCant10" runat="server" Width="64%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT10" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple10" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt10" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport10" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%">
                                <label>
                                    11.</label>
                                <asp:TextBox ID="txtCant11" runat="server" Width="64%" />
                            </td>
                            <td style="width: 40%">
                                <asp:DropDownList ID="ddlConcepte_OT11" runat="server" Width="99%" DataSourceID="odsArticles"
                                    DataTextField="NomArticle" DataValueField="IdArticle" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAmple11" runat="server" Width="99%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtAlt11" runat="server" Width="97%" />
                            </td>
                            <td style="width: 10%">
                                <asp:TextBox ID="txtImport11" runat="server" Width="80%" AutoPostBack="false" />
                                €
                            </td>
                        </tr>
                    </table>
                    <br />
                    <asp:Label CssClass="classBotonsDreta" Text="€" runat="server" style="margin-right:6%;"  />
                    <asp:TextBox ID="txtImportTotal" runat="server" CssClass="classBotonsDreta" AutoPostBack="false" style="margin-right:1%;" /> 
                    <asp:Label runat="server" Text="Total " CssClass="classBotonsDreta" style="padding-right:20px; font-weight:bold;"/>
                    <asp:Button ID="btnCalcImportConcepteOT" runat="server" CssClass="classBotonsDreta" Text="Calcular Import" CausesValidation="true"
                    ToolTip="Calcular l'Import Total dels Conceptes" OnClick="btnCalcImportConcepteOT_Click" style="margin-right:20px;" />
                    <br />
                    <asp:Label Text="Observacions" runat="server" Width="90%" CssClass="classTextOrdre" />
                    <br />
                    <asp:TextBox ID="txtObservacions" runat="server" TextMode="MultiLine" Height="150"
                        Width="95%" />
                    <br />
                    <asp:Label Text="Nom Arxiu" Width="25%" CssClass="classEsquerra" runat="server" />
                    <asp:TextBox ID="txtNomArxiu" runat="server" CssClass="classDreta" Width="70%" />
                    <br />
                    <br />
                    <div style="margin-right: 4%">
                        <asp:Button ID="btnNetejar" Text="Netejar" runat="server" ToolTip="Netejar els camps"
                            CssClass="classBotonsDreta" OnClick="btnNetejar_Click" CausesValidation="false" />
                        <asp:Button ID="btnGuardar" Text="Guardar" runat="server" ToolTip="Guardar una Ordre de Treball"
                            OnClick="btnGuardar_Click" CssClass="classBotonsDreta" CausesValidation="true"
                            OnClientClick="return PrintingOrdre();" />
                        <asp:Button ID="btnCrearAlbara" Text="Imprimir Albarà" ToolTip="Imprimir l'Albarà de l'Ordre actual"
                            CssClass="classBotonsDreta" OnClick="btnCrearAlbara_Click" runat="server" CausesValidation="true" />
                    </div>
                    <br />
                    <%--Crida al control Modal--%>
                    <ctrl:Modal ID="mpCrearOrdre" runat="server" />
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btnCrearAlbara" />
                <asp:PostBackTrigger ControlID="btnImprimirMaquina" />
            </Triggers>
        </asp:UpdatePanel>

        <%--Buscar ordres existents--%>
        <asp:UpdatePanel ID="upBuscarOrdre" runat="server" Visible="true" UpdateMode="Always">
            <ContentTemplate>
                <div>
                    <br />
                    <asp:Label ID="Label1" CssClass="classTitul" runat="server">Buscar Ordre</asp:Label>
                    <br />
                    <br />
                    <label  class="classEsquerra"  style="width:150px;" >Id Ordre treball</label>
                    <asp:TextBox ID="txtCOIdOT" runat="server"  class="classEsquerra" />
                    
                    <label class="classlabelAlta" style="width:80px; margin-left:25px;">Client</label>
                    <asp:DropDownList ID="ddlCOClient" runat="server" Width="150px" AutoPostBack="true" 
                                      DataSourceID="odsClient" DataTextField="NomClient" DataValueField="IdClient" 
                                       class="classEsquerra"/>
                    
                    <label  class="classEsquerra"  style="width:103px; margin-left:28px;" >Nom Arxiu</label>
                    <asp:TextBox ID="txtCONomArxiu" runat="server"  class="classEsquerra" />

                    <br />

                    <label class="classEsquerra" style="clear:both; width:150px; " >Referència Client</label>
                    <asp:TextBox ID="txtCORefClient" runat="server"  class="classEsquerra"/>
                    
                    <label class="classEsquerra" style="width:80px; margin-left:25px;" >Id Treball</label>
                    <asp:TextBox ID="txtCOIdTreball" runat="server"  class="classEsquerra"/>

                    <label class="classEsquerra" style="width:100px; margin-left:25px;" >Pedido Client</label>
                    <asp:TextBox ID="txtCOPedidoClient" runat="server"  class="classEsquerra"/>

                    <br />
                    <br />
                    <div style="margin-right: 4%">
                        <asp:Button ID="btnCercarOT" Text="Cercar OT" ToolTip="Cercar ordres de trebll"
                            runat="server" CssClass="classBotonsDreta" OnClick="btnCercarOT_Click" />
                    </div>
                    <br />
                     
                <%--GridView--%>
                <label class="classEsquerra" style="width: 160px"> Resultas de la cerca</label>
                    <asp:GridView ID="gvOT" AutoGenerateColumns="false" runat="server" EmptyDataText="No hi ha cap Ordre de Treball"
                        Width="900px" AlternatingRowStyle-BackColor="ActiveBorder" AlternatingRowStyle-BorderColor="ActiveCaption"
                        style="margin-right:5%;" OnRowCommand="gvOT_RowCommand" HorizontalAlign="Center" >
                        <Columns>
                            <asp:TemplateField HeaderText="Opcions" ItemStyle-Width="50px">
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnEditGVOT" runat="server" AlternateText="Obrir una OT per a editar-la"
                                        ImageUrl="~/Imatges/editar_Grid.png" CommandName="Editar" 
                                        CommandArgument='<%# Eval("IdOrdre_Treball") %>' CausesValidation="false" />
                                        <%--<asp:CheckBox ID="chkSelectGVOT" runat="server" ToolTip="Seleccionar una OT"  />--%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField ControlStyle-Width="70" HeaderText="Ordre Treball" DataField="IdOrdre_Treball" />
                            <asp:BoundField ControlStyle-Width="70" HeaderText="Client" DataField="BindClient" />
                            <asp:BoundField ControlStyle-Width="70" HeaderText="Data Entrega" DataField="BindData" />
                            <asp:BoundField ControlStyle-Width="70" HeaderText="Nom Arxiu" DataField="NomArxiu" />
                            <asp:BoundField ControlStyle-Width="70" HeaderText="Refèrencia Client" DataField="ReferenciaClient" />
                            <asp:BoundField ControlStyle-Width="70" HeaderText="Id Treball" DataField="IdTreball" />
                            <asp:BoundField ControlStyle-Width="70" HeaderText="Pedido Client" DataField="PedidoClient" />
                        </Columns>
                    </asp:GridView>
                    <br />

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
